﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TwoWheels
{
    public partial class Administrator : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void addProduct_button(object sender, EventArgs e)
        {

            const string cnStr = @"Data Source=DUO-P8600;Initial Catalog=TwoWheels;Integrated Security=True";
            TwoWheelsDatabase tdb = new TwoWheelsDatabase(cnStr);


            String name = ProductName.Text;
            String cat = CategoryName.Text;
            decimal? price = decimal.Parse(Price.Text);
            int? quant = int.Parse(Quantity.Text);
            String path = PicturePath.Text;

            tdb.addProcedure.DodajProdukt(name, cat, price, quant, path);
            tdb.SubmitChanges();
        }
    }
}